package com.styytech.dadabao.utils;

import com.styytech.dadabao.R;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class UiUtils {

	// public static Toast getDefaultToast(Context paramContext, String
	// paramString) {
	// View localView = View.inflate(paramContext, 2130903106, null);
	// ((TextView) localView.findViewById(2131099952)).setText(paramString);
	// Toast localToast = new Toast(paramContext);
	// localToast.setGravity(17, 0, 0);
	// localToast.setDuration(0);
	// localToast.setView(localView);
	// return localToast;
	// }

	public static void rateToString(ViewGroup paramViewGroup,
			Context paramContext, String paramString) {
		paramViewGroup.removeAllViews();
		char[] arrayOfChar = paramString.toCharArray();
		int i = arrayOfChar.length;
		for (int j = 0; j < i; j++) {
			ImageView localImageView = ProductUtils.getImageView(paramContext,
					arrayOfChar[j]);
			if (localImageView != null) {
				LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(
						-2, -2);
				localLayoutParams.setMargins(0, 0,
						CommonUtils.dip2px(paramContext, 2.0F), 0);
				localImageView.setLayoutParams(localLayoutParams);
				paramViewGroup.addView(localImageView);
			}
		}
		addPerCentView(paramViewGroup, paramContext);
	}
	/**
	 * 添加%
	 * @param paramViewGroup
	 * @param paramContext
	 */
	public static void addPerCentView(ViewGroup paramViewGroup,
			Context paramContext) {
		TextView localTextView = new TextView(paramContext);
		localTextView.setText("%");
		localTextView.setTextAppearance(paramContext, R.style.PerentStyle);
		LinearLayout.LayoutParams localLayoutParams = new LinearLayout.LayoutParams(
				-2, -2);
		localLayoutParams.gravity = 80;
		localLayoutParams.setMargins(0, 0, 0,
				CommonUtils.dip2px(paramContext, 12.0F));
		localTextView.setLayoutParams(localLayoutParams);
		paramViewGroup.addView(localTextView);
	}
}